@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

/* Custom font imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600&display=swap');

/* Base styles */
:root {
  --quantum-blue: #1e40af;
  --crypto-green: #059669;
  --proof-purple: #7c2d92;
  --warning-amber: #d97706;
  --success-emerald: #10b981;
  
  /* Animation easing */
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
  
  /* Spacing */
  --stage-padding: 2rem;
  --control-height: 5rem;
  --header-height: 4rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #0f172a;
  color: #f8fafc;
}

/* Ensure main layout doesn't overflow */
.app-layout {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Main stage scrolling */
.main-stage {
  flex: 1;
  position: relative;
  min-height: 0; /* Allow flex item to shrink */
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --quantum-blue: #3b82f6;
    --crypto-green: #10b981;
    --proof-purple: #8b5cf6;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1e293b;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Custom utility classes */
@layer components {
  .glass-effect {
    @apply bg-white/10 backdrop-blur-md border border-white/20;
  }
  
  .glow-quantum {
    box-shadow: 0 0 20px rgba(30, 64, 175, 0.3);
  }
  
  .glow-crypto {
    box-shadow: 0 0 20px rgba(5, 150, 105, 0.3);
  }
  
  .glow-proof {
    box-shadow: 0 0 20px rgba(124, 45, 146, 0.3);
  }
  
  .text-glow {
    text-shadow: 0 0 10px currentColor;
  }
  
  .stage-container {
    @apply relative w-full h-full overflow-y-auto flex items-start justify-center;
    padding: var(--stage-padding);
    padding-top: 2rem;
    padding-bottom: calc(var(--control-height) + 2rem);
    min-height: calc(100vh - var(--header-height));
  }
  
  .header {
    height: var(--header-height);
    flex-shrink: 0;
  }
  
  .control-panel {
    height: var(--control-height);
    @apply fixed bottom-0 left-0 right-0 bg-slate-800/95 backdrop-blur-sm border-t border-slate-700 z-50;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1), 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
  }
  
  .floating-card {
    @apply glass-effect rounded-xl p-6 shadow-2xl;
    transform: translateZ(0);
  }
  
  .gradient-text {
    @apply bg-gradient-to-r from-blue-400 via-purple-400 to-green-400 bg-clip-text text-transparent;
  }
  
  .pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
  }
  
  .typewriter {
    overflow: hidden;
    border-right: 2px solid #3b82f6;
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
  }
}

/* Custom animations */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.8);
  }
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: #3b82f6; }
}

@keyframes float-up-down {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes scale-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Particle effects */
.particle-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.particle-crypto {
  background: radial-gradient(circle, #10b981 0%, transparent 70%);
  animation: float-particle 8s linear infinite;
}

.particle-quantum {
  background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
  animation: float-particle 10s linear infinite;
}

.particle-proof {
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  animation: float-particle 12s linear infinite;
}

@keyframes float-particle {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-20vh) rotate(360deg);
    opacity: 0;
  }
}

/* Loading states */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(59, 130, 246, 0.1);
  border-left: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  animation: loading-bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loading-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  .control-panel,
  .particle-container {
    display: none !important;
  }
}